<?php

namespace app\api\model;

use app\common\model\Feedback as FeedbackModel;

/**
 * 用户收货地址模型
 * Class UserAddress
 * @package app\common\model
 */
class Feedback extends FeedbackModel
{
    /**
     * 隐藏字段
     * @var array
     */
    protected $hidden = [
        'wxapp_id',
        'create_time',
        'update_time'
    ];


    /**
     * 新增
     * @param User $user
     * @param $data
     * @return mixed
     */
    public function add($user, $data)
    {
        return $this->transaction(function () use ($user, $data) {

            // 添加收货地址
            $this->allowField(true)->save([
                'content' => $data['content'],
                'user_id' => $user['user_id'],
                'wxapp_id' => self::$wxapp_id
            ]);
            return true;
        });
    }


}
